/*
 * @lc app=leetcode.cn id=1252 lang=javascript
 *
 * [1252] 奇数值单元格的数目
 */

// @lc code=start
/**
 * @param {number} n
 * @param {number} m
 * @param {number[][]} indices
 * @return {number}
 */
var oddCells = function (n, m, indices) {
    let line = new Set()
    let row = new Set()
    for (let i = 0; i < indices.length; i++) {
        let temp = indices[i]
        if (line.has(temp[0])) { line.delete(temp[0]) } else {
            line.add(temp[0])
        }
        if (row.has(temp[1])) { row.delete(temp[1]) } else {
            row.add(temp[1])
        }
    }
    return n * row.size + m * line.size -   line.size * row.size*2
};
// @lc code=end

oddCells(2,3,[[0,1],[1,1]])